package xj.graph2d.command;

import xj.graph2d.DrawShape;
import xj.graph2d.SimpleDrawDocument;
import xj.graph2d.SimpleDrawView;

public class MoveCornerCommand extends DeltaCommand {

  public MoveCornerCommand(SimpleDrawView view, 
			   SimpleDrawDocument doc,
			   DrawShape shape, 
			   int pos, 
			   boolean scaleSubshapes) {
    super(view, doc, shape);
    this.pos = pos;
    this.scaleSubshapes = scaleSubshapes;
  }

  @Override
  protected void forward() {
    shape.moveCorner(pos, x, y, scaleSubshapes);
    // auxForward();
  }

  @Override
  protected void backward() {
    shape.moveCorner(pos, -x, -y, scaleSubshapes);
    // auxBackward();
  }

  @Override
  public boolean isSignificant() {
    return (x != 0 || y != 0);
  }

  protected int pos;

  protected boolean scaleSubshapes;

}
